import request from '@/utils/request'

export const bookApi = {
  // 分页查询图书
  getBooks(params) {
    return request.get('/books', { params })
  },
  
  // 获取图书详情
  getBook(id) {
    return request.get(`/books/${id}`)
  },
  
  // 获取热门图书
  getHotBooks(limit = 10) {
    return request.get('/books/hot', { params: { limit } })
  },
  
  // 添加图书
  addBook(data) {
    return request.post('/books', data)
  },
  
  // 更新图书
  updateBook(id, data) {
    return request.put(`/books/${id}`, data)
  },
  
  // 删除图书
  deleteBook(id) {
    return request.delete(`/books/${id}`)
  }
}

